﻿using System;
using System.Diagnostics.Contracts;
using Epi.Data;

namespace CDC.SampleShell.Infrastructure
{
    public class MdbDatabaseUpgrader : DatabaseUpgraderBase
    {
        public MdbDatabaseUpgrader(IDbDriver database)
            : base(database)
        {
            Contract.Requires(database != null);
        }

        public override int GetDatabaseVersion()
        {
            if (_version != -1) return _version; // return cached version number if we've already determined the version previously

            _version = 1;

            return _version;
        }

        public override bool UpgradeDatabase()
        {
            // nothing to upgrade for MDB files

            _version = GetDatabaseVersion();

            _version = 1;

            return true;
        }
    }
}
